package com.whpu.mall.product.feign;

import com.whpu.common.to.SkuReductionTo;
import com.whpu.common.to.SpuBoundTo;
import com.whpu.common.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;


@FeignClient("mall-coupon")  //指定调用谁的服务
public interface CouponFeignService {

    /**
     * CouponFeignService.saveSpuBounds()
     *
     * 远程调用保存spu的积分信息
     *  1、@RequestBody将将对象转为json
     *  2、找到 mall-coupon的 /coupon/spubounds/save 请求服务
     *      ,将json放在请求体中发送请求
     *  3、对方服务收到请求,也利用@RequestBody将请求体中的json转为对象
     *       * (@RequestBody SpuBoundsEntity spuBounds)
     *   只要对象模型(字段)是兼容的,双方服务无需使用同一个to
     * @param spuBoundTo
     */
    @PostMapping("/coupon/spubounds/save")
    R saveSpuBounds(@RequestBody SpuBoundTo spuBoundTo);

    /**
     * sku的优惠等信息
     * @param skuReductionTo
     */
    @PostMapping("/coupon/skufullreduction/saveinfo")
    R saveSkuReduction(@RequestBody SkuReductionTo skuReductionTo);
}
